package com.coding.springboot.demo.service;

import com.coding.springboot.demo.dao.TservicenoSetDao;
import com.coding.springboot.demo.entity.TservicenoSet;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import javax.transaction.Transactional;
import java.util.List;

/**
 * Created by qince on 2015/8/3.
 */
@Service
@Transactional
public class TservicenoSetService {

    @Autowired
    private TservicenoSetDao tservicenoSetDao;

    public void save(TservicenoSet tservicenoSet) {
        this.tservicenoSetDao.save(tservicenoSet);
    }

    /**
     * 获取服务号的appid和appsecrect的设置
     *
     * @return
     */
    public TservicenoSet getServiceNo(Long generalid) {
        List<TservicenoSet> l = tservicenoSetDao.getServiceNo(generalid);
        if (l != null && l.size() > 0) {
            return l.get(0);
        }
        return null;
    }
}
